home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / tex / macros / distribs / array / longtable.doc < prev    next >
Text File  |  1992-10-11  |  50KB  |  1,440 lines

  1.  
  2. % \iffalse
  3. %
  4. % This file is part of the array package.
  5. % ---------------------------------------
  6. %
  7. % This file was contributed. In case of error please inform the
  8. % original author.
  9. %
  10. % \fi
  11.  
  12. %\iffalse
  13. %%% ====================================================================
  14. %%%  @LaTeX-style-file{
  15. %%%     filename        = "longtable.sty",
  16. %%%     version         = "3.04",
  17. %%%     date            = "12 October 1992",
  18. %%%     time            = "11:51:56 BST",
  19. %%%     author          = "David Carlisle",
  20. %%%     address         = "Computer Science Department
  21. %%%                        Manchester University
  22. %%%                        Oxford Road
  23. %%%                        Manchester
  24. %%%                        England
  25. %%%                        M13 9PL",
  26. %%%     telephone       = "+44 61 275 6139",
  27. %%%     FAX             = "+44 61 275 6236",
  28. %%%     checksum        = "08304 1428 6676 49483",
  29. %%%     email           = "carlisle@cs.man.ac.uk (Internet)",
  30. %%%     codetable       = "ISO/ASCII",
  31. %%%     keywords        = "LaTeX, array, tabular, page",
  32. %%%     supported       = "yes",
  33. %%%     docstring       = "
  34. %%%
  35. %%%     longtable.sty
  36. %%%
  37. %%%     A LaTeX style option defining a multi-page version of tabular.
  38. %%%
  39. %%%     The checksum field above was produced by
  40. %%%     Robert Solovay's checksum utility.",
  41. %%%  }
  42. %%% ====================================================================
  43.  
  44. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  45. %
  46. % Version 1 20-Dec-1990
  47. %
  48. % Version 2 17-June-1991
  49. %
  50. %  *  Works with the New Font Selection Scheme.
  51. %  *  Works with Mittelbach's array.sty.
  52. %
  53. % Version 3 16-March-1992
  54. %
  55. %  *  New implementation. longtables may now start anywhere on the page.
  56. %  *  The code is now self-documenting, using Mittelbach's doc.sty.
  57. %
  58. % Version 3.01 6-April-1992
  59. %
  60. %  *  (Michel Goossens) If a chunk ends on a line in which the first
  61. %     entry is empty, wierd errors occur. Added special begin and end
  62. %     groups, ({\ifnum0=`}\fi) stuff as  explained in Appendix D.
  63. %
  64. % Version 3.02 9-April-1992
  65. %
  66. %  *  (Michel Goossens) Longtable fails if the table counter is reset
  67. %     during a document. Now use an internal counter, but still
  68. %     increment table so \caption and \label work out right.
  69. %
  70. % Version 3.03 25-June-1992
  71. %
  72. %  *  Add \@ifundefined{reset@font} so that the documentation may be
  73. %     processed with old versions of LaTeX.
  74. %  *  Modify the treatment of \d@llar to match the new versions of
  75. %     Mittelbach's array.sty (array.sty v2.0h)
  76. %  *  Added the standard file header proposed by Nelson Beebe
  77. %
  78. % Version 3.04 12-October-1992
  79. %
  80. %  *  (Jean-Pierre Drucbert) Longtable failed when used with
  81. %     \includeonly. Fixed by replacing the \newcount\LT@tables by
  82. %     \newcounter{LT@tables} as LaTeX counters are correctly preserved
  83. %     by \include. (This bug was introduced in V3.02, as previously the
  84. %     LaTeX counter `table' was used.)
  85. %  *  Fix bug which stopped \kill working correctly in headings.
  86. %  *  (Graham Gough) Made \setlongtables issue a warning message.
  87. %  *  (Sebastian Rahtz) longtable ran out of memory on really long
  88. %     tables. Another bug introduced in V3! I had forgotten to call \par
  89. %     to force the page-breaker to consider page breaks after every
  90. %     chunk.
  91. %
  92. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  93. %\fi
  94. %
  95. \def\fileversion{v3.04}
  96. \def\filedate{92/10/12}
  97. \def\docdate {92/10/12}
  98. %
  99. % \CheckSum{863}
  100. % \CharacterTable
  101. %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
  102. %   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
  103. %   Digits        \0\1\2\3\4\5\6\7\8\9
  104. %   Exclamation   \!     Double quote  \"     Hash (number) \#
  105. %   Dollar        \$     Percent       \%     Ampersand     \&
  106. %   Acute accent  \'     Left paren    \(     Right paren   \)
  107. %   Asterisk      \*     Plus          \+     Comma         \,
  108. %   Minus         \-     Point         \.     Solidus       \/
  109. %   Colon         \:     Semicolon     \;     Less than     \<
  110. %   Equals        \=     Greater than  \>     Question mark \?
  111. %   Commercial at \@     Left bracket  \[     Backslash     \\
  112. %   Right bracket \]     Circumflex    \^     Underscore    \_
  113. %   Grave accent  \`     Left brace    \{     Vertical bar  \|
  114. %   Right brace   \}     Tilde         \~}
  115. %
  116. %
  117. %
  118. % \makeatletter
  119. % \@ifundefined{reset@font}{}{}
  120. % \def\@oddfoot{\reset@font\rm\dotfill Page \thepage\dotfill}
  121. % \def\@oddhead{\dotfill{\reset@font\tt longtable.sty}\dotfill}
  122. % \def\ps@titlepage{\let\@oddhead\@empty}
  123. % \makeatother
  124. %
  125. %
  126. % \LTleft=\parindent
  127. % \LTright=\fill
  128. % \LTchunksize=10
  129. %
  130. % \title{longtable.sty\thanks
  131. %   {Version \fileversion, revised \filedate, documentation dated
  132. %   \docdate}}
  133. % \author{D. P. Carlisle}
  134. % \date{12 October 1992}
  135. %
  136. %
  137. % \maketitle
  138. %
  139. % \begin{abstract}
  140. %  This style defines the {\tt longtable} environment, a multi-page
  141. %  version of {\tt tabular}.
  142. % \end{abstract}
  143. %
  144. % ^^A \vbox to 100pt makes the page breaks the same on the first run.
  145. % \vbox to 100pt{\listoftables\vss}
  146. %
  147. % \section{Introduction}
  148. %
  149. % {\tt longtable.sty} defines a new environment, \DescribeEnv{longtable}
  150. % {\tt longtable}, which has most of the features of the {\tt tabular}
  151. % environment, but produces tables which may be broken by \TeX's
  152. % standard page-breaking algorithm. It also shares some features with
  153. % the {\tt table} environment. In particular it uses the same counter,
  154. % {\tt table}, and has a similar "\caption" command. Also, the standard
  155. % "\listoftables" command lists tables produced by either the {\tt
  156. % table} or {\tt longtable} environments.
  157. %
  158. % The following example uses most of the features of the {\tt longtable}
  159. % environment. An edited listing of the input for this example appears
  160. % in Section~\ref{listing}.
  161. %
  162. % \begin{longtable}{@{*}r||p{1in}@{*}}
  163. % KILLED & LINE!!!! \kill
  164. % \caption[An optional caption (for the list of tables)]{A long
  165. % table\label{long}}\\
  166. % \hline\hline
  167. % \multicolumn{2}{@{*}c@{*}}%
  168. %      {This part appears at the top of the table}\\
  169. % \sc First&\sc Second\\
  170. % \hline\hline
  171. % \endfirsthead
  172. % \caption[]{(continued)}\\
  173. % \hline\hline
  174. % \multicolumn{2}{@{*}c@{*}}%
  175. %       {This part appears at the top of every other page}\\
  176. % \bf First&\bf Second\\
  177. % \hline\hline
  178. % \endhead
  179. % \hline
  180. % This goes at the&bottom.\\
  181. % \hline
  182. % \endfoot
  183. % \hline
  184. % These lines will&appear\\
  185. % in place of the & usual foot\\
  186. % at the end& of the table\\
  187. % \hline
  188. % \endlastfoot
  189. % {\tt longtable}  columns  are specified& in the \\
  190. % same way as  in the {\tt tabular}& environment.\\
  191. % "@{*}r||p{1in}@{*}"& in this case.\\
  192. % Each row ends with a& "\\" command.\\
  193. % The "\\"  command  has an& optional\\
  194. % argument, just as in& the\\
  195. %  {\tt tabular}&environment.\\[10pt]
  196. % See the  effect  of "\\[10pt]"&?\\
  197. % Lots of lines& like this.\\
  198. % Lots of lines& like this.\\
  199. % Lots of lines& like this.\\
  200. % Lots of lines& like this.\\
  201. % Also  "\hline"  may be used,&  as in {\tt tabular}.\\
  202. % \hline
  203. % That  was a "\hline"&.\\
  204. % \hline\hline
  205. % That  was "\hline\hline"&.\\
  206. % \multicolumn{2}{||c||}%
  207. % {This is a \tt\char`\\multicolumn\char`{2\char`}\char`{||c||\char`}}\\
  208. % If a  page break  occurs at a "\hline" then& a line is drawn\\
  209. % at the bottom of one  page  and at the& top of the next.\\
  210. % \hline
  211. % The  "[t] [b] [c]"  argument of {\tt tabular}& can  not be used.\\
  212. % The optional argument may be  one of& "[l] [r] [c]"\\
  213. % to specify whether  the  table  should be& adjusted\\
  214. % to the  left, right& or centrally.\\
  215. % \hline\hline
  216. % Some lines may take up a lot of space, like this: &
  217. %     \begin{flushright} This last column is a ``p'' column so this
  218. %     ``row'' of the table can take up several lines. Note however that
  219. %     \TeX\ will  never break a page within such a row. Page breaks only
  220. %     occur between rows of the table or at "\hline" commands.
  221. %     \end{flushright}\\
  222. % Lots of lines& like this.\\
  223. % Lots of lines& like this.\\
  224. % Lots of lines& like this.\\
  225. % Lots of lines& like this.\\
  226. % Lots of lines& like this.\\
  227. % Lots of lines& like this.\\
  228. % Lots of lines& like this.\\
  229. % Lots of lines& like this.\\
  230. % Lots of lines& like this.\\
  231. % Lots of lines& like this.\\
  232. % Lots of lines& like this.\\
  233. % Lots of lines& like this.\\
  234. % Lots of lines& like this.\\
  235. % Lots of lines& like this.\\
  236. % Lots of lines& like this.\\
  237. % Lots of lines& like this.\\
  238. % Lots of lines& like this.\\
  239. % Lots of lines& like this.\\
  240. % Lots of lines& like this.\\
  241. % Lots of lines& like this.\\
  242. % Lots of lines& like this.\\
  243. % Lots of lines& like this.\\
  244. % Lots of lines& like this.\\
  245. % Lots of lines& like this.\\
  246. % Lots of lines& like this.\\
  247. % Lots of lines& like this.\\
  248. % Lots of lines& like this.\\
  249. % Lots of lines& like this.\\
  250. % \hline
  251. % Lots\footnote{This is a footnote.} of lines& like this.\\
  252. % Lots   of   lines& like this\footnote{{\tt longtable} takes special
  253. %     precautions, so that footnotes may also be used in `p' columns.}\\
  254. % \hline
  255. % Lots of lines& like this.\\
  256. % Lots of lines& like this.
  257. % \end{longtable}
  258. %
  259. % \section{Chunk Size}
  260. %
  261. % \DescribeMacro{\LTchunksize}
  262. % In order to \TeX\ multi-page tables, it is necessary to break up the
  263. % table into smaller chunks, so that \TeX\ does  not have to keep
  264. % everything in memory at one time. By default {\tt longtable} uses 20
  265. % rows per chunk, but this can be set by the user, with e.g.,
  266. % "\LTchunksize=10". These chunks do not affect page breaking,
  267. % thus if you are using a \TeX\ with a lot of memory, you can set
  268. % "\LTchunksize" to be several pages of the table. \TeX\ will run
  269. % faster with a large "\LTchunksize". However, if necessary, {\tt
  270. % longtable} can work with "\LTchunksize=1", in which case the memory
  271. % taken up is negligible.
  272. % Note that if you use the commands for setting the table head or foot
  273. % (see below), the "\LTchunksize" must be at least  as large as the
  274. % number of rows in each of the head or foot sections.
  275. %
  276. % This document specifies "\LTchunksize=10". If you look at the
  277. % previous table, you will see that various parts of the table do not
  278. % line up. Also \LaTeX\ will have printed a warning that the column
  279. % widths had changed. {\tt longtable} writes information onto the {\tt
  280. % .aux} file, so that it can line up the different chunks; however, it
  281. % does not use this information unless a \DescribeMacro{\setlongtables}
  282. % "\setlongtables" command is given before the table starts. It is best
  283. % not to use this command until the document is nearly complete, as
  284. % otherwise {\tt longtable} will leave enough room in each column for
  285. % the widest entry {\it in all previous versions\/}. (At least since the
  286. % {\tt .aux} file was last removed.)
  287. %
  288. % If you look at the preamble to this document, in the file {\tt
  289. % longtable.drv}, you will see a line "%\setlongtables". If you delete
  290. % the "%" and re-\LaTeX\ the document, all the tables will line up
  291. % perfectly. (You may need to \LaTeX\ the document twice if the {\tt
  292. % .aux} file has been destroyed.)
  293. %
  294. % \begin{table}
  295. % \centering
  296. % \begin{tabular}{||l|l|l||}
  297. % \hline\hline
  298. % A&\tt tabular& environment\\
  299. % \hline
  300. % within&a floating& \tt table\\
  301. % \hline\hline
  302. % \end{tabular}
  303. % \caption{A floating table}
  304. % \end{table}
  305. %
  306. % \section{Captions and Headings}
  307. %
  308. % At the start of the table one may specify lines which are to appear at
  309. % the top of every page (under the headline, but before the other lines
  310. % of the table).
  311. % \DescribeMacro{\endhead}
  312. % The lines are entered as normal, but the last "\\" command is
  313. % replaced by a "\endhead" command.
  314. % \DescribeMacro{\endfirsthead}
  315. % If the first page should have a different heading, then this should be
  316. % entered in the same way, and terminated with the "\endfirsthead"
  317. % command. The "\LTchunksize" should be at least as large as the
  318. % number of rows in the heading.
  319. % \DescribeMacro{\endfoot}
  320. % There are also "\endfoot" and "\endlastfoot"
  321. %\DescribeMacro{\endlastfoot}
  322. % commands which are used in the same way (at the {\em start\/} of the
  323. % table) to specify rows (or an "\hline") to appear at the bottom of
  324. % each page. In certain situations, you may want to place lines which
  325. % logically belong in the table body at the end of the {\tt firsthead},
  326. % or the beginning of the {\tt lastfoot}. This helps to control which
  327. % lines appear on the first and last page of the table.
  328. %
  329. % \DescribeMacro{\caption}%
  330. % The "\caption{...}" command is essentially equivalent to\\
  331. % "\multicolumn{n}{c}{\parbox{\LTcapwidth}{...}}"\\
  332. % where {\tt n} is the number of columns of the table. You may set the
  333. % width of the caption with a command such as "\LTcapwidth=3in" in the
  334. % preamble of your document. The default is 4in. "\caption" also
  335. % writes the information to produce an entry in the list of tables. As
  336. % with the "\caption" command in the {\tt figure} and {\tt table}
  337. % environments, an optional argument specifies the text to appear in the
  338. % list of tables if this is different from the text to appear in the
  339. % caption. Thus the caption for table \ref{long} was specified as
  340. % {\tt"\caption"[An optional caption (for the list of tables)]\{A long
  341. %  table"\label{long}"\}}.
  342. %
  343. % You may wish the caption on later pages to be different to that on the
  344. % first page. In this case put the "\caption" command in the first
  345. % heading, and put a subsidiary caption in a "\caption[]" command in
  346. % the main heading. If the optional argument to "\caption" is empty,
  347. % no entry is made in the list of tables. Alternatively, if you do not
  348. % want the table number to be printed each time, use the "\caption*"
  349. % command.
  350. %
  351. % You may use the "\label" command so that you can cross reference
  352. % {\tt longtable}s with "\ref". Note however, that the "\label" command
  353. % should not be used in a heading that may appear more than once. Place
  354. % it either in the {\tt firsthead}, or in the body of the table. It
  355. % should not be the {\em first\/} command in any entry.
  356. %
  357. % \section{Multicolumn entries}
  358. %
  359. % "\multicolumn" entries present a particular problem for {\tt
  360. % longtable}.
  361. % Suppose we were trying to typeset the following table,
  362. % with"\LTchunksize=1".
  363. %
  364. % {\LTchunksize=1
  365. %
  366. %   \begin{longtable}[c]{|l|l|}
  367. %   \caption{A good example\label{good}}\\
  368. %   \hline
  369. %   \multicolumn{2}{|c|}{A wide multicolumn entry}\\
  370. %   A wide column in a different chunk&narrow\\
  371. %   \hline
  372. %   \end{longtable}}
  373. %
  374. % If after the first chunk, {\tt longtable} had only seen the wide
  375. % multicolumn entry, then it would think that the first column was very
  376. % narrow (just containing the rules and glue specified by "|l|"). All
  377. % the width of the multicolumn entry would be assumed to be in the
  378. % second column. (This is a `feature' of \TeX's primitive "\halign"
  379. % command.) {\tt longtable} would then pass the information that there
  380. % is a wide second column to the second chunk, with the result that the
  381. % final table would be much too wide, like this:
  382. %
  383. % {\LTchunksize=1
  384. %   \let\LTmulticolumn\multicolumn
  385. %
  386. %   \begin{longtable}[c]{|l|l|}
  387. %   \caption{A bad example\label{bad}}\\
  388. %   \hline
  389. %^^A
  390. %^^A If you do not use the draft \multicolumn, you may have to use \kill
  391. %^^A
  392. %^^A A wide column in a different chunk&narrow\kill
  393. %^^A
  394. %   \multicolumn{2}{|c|}{A wide multicolumn entry}\\
  395. %   A wide column in a different chunk&narrow\\
  396. %   \hline
  397. %   \end{longtable}}
  398. %
  399. % \DescribeMacro{\kill}%
  400. % The solution to this problem used in Versions 1~and~2, was to use a
  401. % "\kill" line. If a line is "\kill"ed, by using "\kill" rather than
  402. % "\\" at the end of the line, it is used in calculating
  403. % column widths, but removed from the final table. Thus entering a
  404. % "\kill"ed copy of the second row before the multicolumn entry would
  405. % mean that "\halign" `saw' the wide entry in the first column, and so
  406. % did not widen the second column to make room for the multicolumn
  407. % entry.
  408. %
  409. % In Version~3, a new solution has been introduced. If the saved row in
  410. % the {\tt .aux} file is not being used, {\tt longtable} uses a special
  411. % `draft' form of "\multicolumn", this modifies the definition, so the
  412. % spanning entry is never considered to be wider than the columns it is
  413. % spanning. So after the first pass, the {\tt .aux} file stores the
  414. % widest normal entry for each column, no column has been widened due to
  415. % "\span"ned columns. By default {\tt longtable} ignores the {\tt .aux}
  416. % file, and so each run of \LaTeX\ is considered a first pass. Once the
  417. % "\setlongtables" declaration is given, the saved row in the {\tt .aux}
  418. % file, and the proper definition of "\multicolumn" are used. If any
  419. % "\multicolumn" entry causes one of the columns to be widened, this
  420. % information can not be passed back to earlier chunks, and so the table
  421. % will not correctly line up until the third pass.
  422. %
  423. % This new system means that "\kill" is essentially redundant, however I
  424. % think that some people will object to \LaTeX-ing a file three times,
  425. % and so I have made it easy to revert to the Version~2 behaviour.
  426. % Giving the declaration "\let\LTmulticolumn=\multicolumn" will stop
  427. % multicolumn entries being set in draft mode, and so in order to avoid
  428. % bad examples like Table~\ref{bad}, you will need to use "\kill" as
  429. % discussed above.
  430. %
  431. % If you object even to \LaTeX-ing a file twice, you should
  432. % disable "\LTmulticolumn" as above, and also make the first line of
  433. % every {\tt longtable} a "\kill" line that contains the widest entry
  434. % to be used in each column. All chunks will then line up on the first
  435. % pass, and "\setlongtables" need not be used at all.
  436. %
  437. % \section{Adjustment}
  438. %
  439. % The last two tables also show the use of the optional argument. They
  440. % are set with "\begin{longtable}[c] ..." specifying that the table
  441. % should be centred. The other options are "[r]" "[l]", for right
  442. % and left adjustment, respectively.
  443. % \DescribeMacro{\LTleft}
  444. % Normally centering is the default, but this document specifies
  445. % \DescribeMacro{\LTright}
  446. % \begin{verbatim}
  447. % \LTleft=\parindent
  448. % \LTright=\fill
  449. % \end{verbatim}
  450. % in the preamble, which means that the tables are set flush left, but
  451. % indented by the usual paragraph indentation. Any lengths can be
  452. % specified for these two parameters, but at least one of them should be
  453. % a rubber length so that it fills up the width of the page, unless
  454. % rubber lengths are added between the columns using the
  455. % "\extracolumnsep" command.
  456. %
  457. % \section{Changes Since Version 2}
  458. %
  459. % There have been several changes made between versions 2 and 3.
  460. % \begin{itemize}
  461. % \item The mechanism for adding the head and foot of the table has been
  462. % completely rewritten. With this new mechanism, {\tt longtable} does
  463. % not need to issue a "\clearpage" at the start of the table, and so the
  464. % table may start half way down a page. Also the "\endlastfoot" command
  465. % which could not safely be implemented under the old scheme, has been
  466. % added.
  467. % \item {\tt longtable} now issues an error if started in the scope of
  468. % "\twocolumn", or the {\tt multicols} environment.
  469. % \item The separate documentation file {\tt longtable.tex} has been
  470. % merged with the style file, {\tt longtable.sty} using Mittelbach's
  471. % {\tt doc.sty}.
  472. % \item Support for footnotes has been added.
  473. % \item The treatment of "\multicolumn" has changed, making
  474. % "\kill" lines unnecessary, at the price of sometimes requiring a
  475. % third pass through \LaTeX.
  476. % \item The "\newpage" command now works inside a {\tt longtable}.
  477. % \end{itemize}
  478. %
  479. % In particular, the first of these changes means that Version~3 may not
  480. % be able to exactly reproduce documents originally developed with
  481. % Version~2, even if "\clearpage" commands are placed before and after
  482. % the {\tt longtable} environment. For this reason, individual users,
  483. % {\em not archives}, may want to retain Version~2 under a different
  484. % name if they have documents using Version~2.
  485. %
  486. % \section{Summary}
  487. %
  488. % \small
  489. % \begin{longtable}{@{}l@{\hspace{10pt}}l@{}}
  490. % \caption[A summary of {\tt longtable} commands]%
  491. %         {\protect\normalsize A summary of {\tt longtable} commands}\\
  492. % \multicolumn{2}{c}{\bf Parameters}\\
  493. % \hline
  494. % "\LTleft"&
  495. %     Glue to the left of the table.           \hfill("\fill")\\
  496. % "\LTright"&
  497. %     Glue to the right of the table.          \hfill("\fill")\\
  498. % "\LTpre"&
  499. %     Glue before the the table.      \hfill("\bigskipamount")\\
  500. % "\LTpost"&
  501. %     Glue after the the table.       \hfill("\bigskipamount")\\
  502. % "\LTchunksize"&
  503. %     The number of rows per chunk.                 \hfill(20)\\
  504. % "\LTcapwidth"&
  505. %     The width of a parbox containing the caption.\hfill(4in)\\[5pt]
  506. % \multicolumn{2}{c}{\bf Setlongtables}\\
  507. % \hline
  508. % "\setlongtables"&     Use column widths from the previous run.\\[5pt]
  509. % \multicolumn{2}{c}{{\bf
  510. %      Optional arguments to} \tt\char`\\begin\char`{longtable\char`}}\\
  511. % \hline
  512. % \it none& Position as specified by "\LTleft" and "\LTright",
  513. %             usually centre.\\
  514. % \tt[c]&   Centre the table.\\
  515. % \tt[l]&   Place the table flush left.\\
  516. % \tt[r]&   Place the table flush right.\\[5pt]
  517. % \multicolumn{2}{c}{{\bf Commands available inside} \tt longtable}\\
  518. % \hline
  519. % "\endhead"&
  520. %     Specifies rows to appear at the top of every page.\\
  521. % "\endfirsthead"&
  522. %     Specifies rows to appear at the top the first page.\\
  523. % "\endfoot"&
  524. %     Specifies rows to appear at the bottom of every page.\\
  525. % "\endlastfoot"&
  526. %     Specifies rows to appear at the bottom of the last page.\\
  527. % "\kill"&
  528. %     Row is `killed', but is used in calculating widths.\\
  529. % "\caption{foo}"&
  530. %     Caption `Table ?: foo', and a `foo' entry in the list of tables.\\
  531. % "\caption[bar]{foo}"&
  532. %     Caption `Table ?: foo', and a `bar' entry in the list of tables.\\
  533. % "\caption[]{foo}"&
  534. %     Caption `Table ?: foo', but no entry in the list of tables.\\
  535. % "\caption*{foo}"&
  536. %     Caption `foo', but no entry in the list of tables.\\
  537. % "\newpage"&
  538. %     Force a page break.
  539. % \end{longtable}
  540. %
  541. % \clearpage
  542. % \section{Verbatim highlights from Table \protect\ref{long}}
  543. % \label{listing}
  544. % \begingroup\catcode`\/=0
  545. % \begin{verbatim}
  546. % \begin{longtable}{@{*}r||p{1in}@{*}}
  547. % KILLED & LINE!!!! \kill
  548. % \caption[An optional caption /ldots]{A long table\label{long}}\\
  549. % \hline\hline
  550. % \multicolumn{2}{@{*}c@{*}}%
  551. %      {This part appears at the top of the table}\\
  552. % \sc First&\sc Second\\
  553. % \hline\hline
  554. % \endfirsthead
  555. % \caption[]{(continued)}\\
  556. % \hline\hline
  557. % \multicolumn{2}{@{*}c@{*}}%
  558. %       {This part appears at the top of every other page}\\
  559. % \bf First&\bf Second\\
  560. % \hline\hline
  561. % \endhead
  562. % \hline
  563. % This goes at the&bottom.\\
  564. % \hline
  565. % \endfoot
  566. % \hline
  567. % These lines will&appear\\
  568. % in place of the & usual foot\\
  569. % at the end& of the table\\
  570. % \hline
  571. % \endlastfoot
  572. % {\tt longtable}  columns  are specified& in the \\
  573. % same way as  in the {\tt tabular}& environment.\\
  574. % /ldots
  575. % \multicolumn{2}{||c||}{This is a /ldots}\\
  576. % /ldots
  577. % Lots of lines& like this.\\
  578. % /ldots
  579. % \hline
  580. % Lots\footnote{/ldots} of lines& like this.\\
  581. % Lots   of   lines& like this\footnote{/ldots}\\
  582. % \hline
  583. % Lots of lines& like this.\\
  584. % /ldots
  585. % \end{longtable}
  586. % \end{verbatim}
  587. % \endgroup
  588. %
  589. % \StopEventually{}
  590. %
  591. % \section{The Macros}
  592. %
  593. % Stop this file being read twice.
  594. %    \begin{macrocode}
  595. %<*style>
  596. \@ifundefined{LT@ignore@aux}{}{\endinput}
  597. \wlog{Style-Option: `longtable' \fileversion
  598.          \space\space <\filedate> (D.P.C.)}
  599. \wlog{English documentation dated \space <\docdate> (D.P.C.)}
  600. %    \end{macrocode}
  601. %
  602. % \subsection{User Setable Parameters}
  603. %
  604. % \begin{macro}{\LTleft}
  605. % \begin{macro}{\LTright}
  606. % Glue to the left and right of the table, default "\fill" (ie
  607. % centred).
  608. %    \begin{macrocode}
  609. \newskip\LTleft       \LTleft=\fill
  610. \newskip\LTright      \LTright=\fill
  611. %    \end{macrocode}
  612. % \end{macro}
  613. % \end{macro}
  614. %
  615. % \begin{macro}{\LTpre}
  616. % \begin{macro}{\LTpost}
  617. % Glue before and after the {\tt longtable}.  "\bigskip" by default.
  618. %    \begin{macrocode}
  619. \newskip\LTpre        \LTpre=\bigskipamount
  620. \newskip\LTpost       \LTpost=\bigskipamount
  621. %    \end{macrocode}
  622. % \end{macro}
  623. % \end{macro}
  624. %
  625. % \begin{macro}{\LTchunksize}
  626. % Chunk size (The number of rows taken per "\halign"). Default 20.
  627. %    \begin{macrocode}
  628. \newcount\LTchunksize \LTchunksize=20
  629. %    \end{macrocode}
  630. % \end{macro}
  631. %
  632. % \begin{macro}{\LTcapwidth}
  633. % Width of the "\parbox" containing the caption. Default 4in.
  634. %    \begin{macrocode}
  635. \newdimen\LTcapwidth  \LTcapwidth=4in
  636. %    \end{macrocode}
  637. % \end{macro}
  638. %
  639. % \subsection{Internal Parameters}
  640. %
  641. % \begin{macro}{\LT@head}
  642. % \begin{macro}{\LT@firsthead}
  643. % \begin{macro}{\LT@foot}
  644. % \begin{macro}{\LT@lastfoot}
  645. % Boxes for the table head and foot.
  646. %    \begin{macrocode}
  647. \newbox\LT@head
  648. \newbox\LT@firsthead
  649. \newbox\LT@foot
  650. \newbox\LT@lastfoot
  651. %    \end{macrocode}
  652. % \end{macro}
  653. % \end{macro}
  654. % \end{macro}
  655. % \end{macro}
  656. %
  657. % \begin{macro}{\LT@cols}
  658. % Counter for number of columns.
  659. %    \begin{macrocode}
  660. \newcount\LT@cols
  661. %    \end{macrocode}
  662. % \end{macro}
  663. %
  664. % \begin{macro}{\LT@rows}
  665. % Counter for rows up to chunksize.
  666. %    \begin{macrocode}
  667. \newcount\LT@rows
  668. %    \end{macrocode}
  669. % \end{macro}
  670. %
  671. % \begin{macro}{\c@LT@tables}
  672. % Counter for the tables, added in V3.02. Previous versions just used
  673. % the \LaTeX\ counter {\tt table}, but this fails if {\tt table} is
  674. % reset during a document, eg {\tt report} style resets it every
  675. % chapter.
  676. %
  677. % This was changed from "\newcount\LT@tables" in V3.04. \LaTeX\ counters
  678. % are preserved correctly when "\includeonly" is used. In the rest of
  679. % the file "\LT@tables" has been replaced by "\c@LT@tables" without
  680. % further comment. Don't ask what "\relax" is doing here!
  681. %    \begin{macrocode}
  682. \newcounter{LT@tables}\relax
  683. %    \end{macrocode}
  684. % \end{macro}
  685. %
  686. % \begin{macro}{\LT@p@ftn}
  687. % Temporary storage for footnote text in a `p' column.
  688. %    \begin{macrocode}
  689. \newtoks\LT@p@ftn
  690. %    \end{macrocode}
  691. % \end{macro}
  692. %
  693. % \begin{macro}{\LT@end@pen}
  694. % Special penalty for the end of the table. Done this way to save using
  695. % up a count register.
  696. %    \begin{macrocode}
  697. \mathchardef\LT@end@pen=30000
  698. %    \end{macrocode}
  699. % \end{macro}
  700. %
  701. % \subsection{The {\tt longtable} environment}
  702. %
  703. % \begin{macro}{\longtable}
  704. % Called by "\begin{longtable}". This implementation does not work in
  705. % multiple column formats. "\par" added at V3.04.
  706. %    \begin{macrocode}
  707. \def\longtable{%
  708.   \par
  709.   \ifx\multicols\@undefined\else
  710.      \ifnum\col@number>\@ne\@twocolumntrue\fi\fi
  711.   \if@twocolumn\@latexerr{longtable not in 1-column mode.}\@ehc\fi
  712.   \begingroup
  713. %    \end{macrocode}
  714. % Check for an optional argument.
  715. %    \begin{macrocode}
  716.   \@ifnextchar[{\LT@array}{\LT@array[x]}}
  717. %    \end{macrocode}
  718. % \end{macro}
  719. %
  720. % \begin{macro}{\LT@array}
  721. % Start setting the alignment. Based on "\@array" from {\tt latex.tex}
  722. % and {\tt array.sty}.
  723. %
  724. % Since Version 3.02, {\tt longtable} has used the internal counter
  725. % "\c@LT@tables". The \LaTeX\ counter {\tt table} is still incremented
  726. % so that "\caption" works correctly.
  727. %    \begin{macrocode}
  728. \def\LT@array[#1]#2{%
  729.   \refstepcounter{table}\global\advance\c@LT@tables\@ne
  730. %    \end{macrocode}
  731. % Set up the glue around the table if an optional argument given.
  732. %    \begin{macrocode}
  733.   \if l#1\LTleft\z@ \LTright\fill
  734.    \else\if r#1\LTleft\fill \LTright\z@
  735.      \else\if c#1\LTleft\fill \LTright\fill \fi\fi\fi
  736. %    \end{macrocode}
  737. % Set up these internal commands for {\tt longtable}.
  738. %    \begin{macrocode}
  739.   \global\let\LT@mcw@rn\relax\let\LT@mc\multicolumn
  740.   \let\\\LT@tabularcr\def\newpage{\noalign{\break}}%
  741.   \let\hline\LT@hline \let\kill\LT@kill\let\caption\LT@caption
  742.   \@tempdima\ht\strutbox
  743. %    \end{macrocode}
  744. % Set up internal commands according to Lamport or Mittelbach.
  745. %    \begin{macrocode}
  746.   \ifx\extrarowheight\LT@undef
  747. %    \end{macrocode}
  748. % Initialise these commands as in {\tt latex.tex}.
  749. %    \begin{macrocode}
  750.     \let\@acol\@tabacol
  751.     \let\@classz\@tabclassz \let\@classiv\@tabclassiv
  752.     \def\@startpbox{\vtop\LT@startpbox}\let\LT@LL@FM@cr\@tabularcr
  753.   \else
  754. %    \end{macrocode}
  755. % Initialise these commands as in {\tt array.sty}. "\d@llar" was
  756. % replaced by "\d@llarbegin" "\d@llarend"  in V3.03 to match {\tt
  757. % array.sty} V2.0h. We do not need to set "\d@llarbegin" and
  758. % "\d@llarend"  as array.sty gives them the correct values at the top
  759. % level.
  760. %    \begin{macrocode}
  761.     \advance\@tempdima\extrarowheight
  762.     \col@sep\tabcolsep
  763.     \let\@startpbox\LT@startpbox\let\LT@LL@FM@cr\@arraycr
  764.   \fi
  765. %    \end{macrocode}
  766. % The rest of this macro is mainly based on {\tt array.sty}, but should
  767. % work for the standard {\tt tabular} too.
  768. %    \begin{macrocode}
  769.   \setbox\@arstrutbox\hbox{\vrule
  770.     \@height \arraystretch \@tempdima
  771.     \@depth \arraystretch \dp \strutbox
  772.     \@width \z@}%
  773.   \let\@sharp##\let\protect\relax
  774. %    \end{macrocode}
  775. % Interpret the preamble argument.
  776. %    \begin{macrocode}
  777.    \begingroup
  778.     \@mkpream{#2}%
  779. %    \end{macrocode}
  780. % We need to rename "\@preamble" here as F.M.'s scheme uses
  781. % "\global", and we may need to nest "\@mkpream", eg for
  782. % "\multicolumn"
  783. % or an {\tt array}. We do not need to worry about nested longtables
  784. % though!
  785. %    \begin{macrocode}
  786.     \xdef\LT@bchunk{\global\LT@rows\z@\setbox\z@\vbox\bgroup
  787.        \tabskip\LTleft\halign to \hsize\bgroup
  788.       \tabskip\z@ \@arstrut \@preamble \tabskip\LTright \cr}%
  789.   \endgroup
  790. %    \end{macrocode}
  791. % Find out how many columns we have (store in "\LT@cols").
  792. %    \begin{macrocode}
  793.   \expandafter\LT@nofcols\LT@bchunk&\LT@nofcols
  794. %    \end{macrocode}
  795. % Get the saved row from "\LT@i"\ldots"\LT@ix" (from the {\tt
  796. % .aux}  file), or make a new blank row.
  797. %    \begin{macrocode}
  798.   \LT@make@row
  799. %    \end{macrocode}
  800. % A few more internal commands for {\tt longtable}.
  801. %    \begin{macrocode}
  802.   \let\@endpbox\LT@endpbox
  803.   \m@th\let\par\@empty
  804.   \everycr{}\lineskip\z@\baselineskip\z@
  805. %    \end{macrocode}
  806. % Start the first chunk.
  807. %    \begin{macrocode}
  808.   \LT@bchunk}
  809. %    \end{macrocode}
  810. % \end{macro}
  811. %
  812. % \begin{macro}{\LT@start}
  813. % This macro starts the process of putting the table on the current
  814. % page. It is not called until either a "\\" or "\endlongtable" command
  815. % ends a chunk, as we do not know until that point which of the four
  816. % possible head or foot sections have been specified.
  817. %
  818. % It begins by redefining itself, so that the table is only started
  819. % once! Until V3.04, was redefined to "\relax", now use "\endgraf" to
  820. % force the page-breaker to wake up.
  821. %    \begin{macrocode}
  822. \def\LT@start{%
  823.   \let\LT@start\endgraf
  824.   \endgraf\penalty\z@\vskip\LTpre
  825. %    \end{macrocode}
  826. % Start a new page if there is not enough room for the table head, foot,
  827. % and one extra line.
  828. %    \begin{macrocode}
  829.   \dimen@\pagetotal
  830.   \advance\dimen@ \ht\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
  831.   \advance\dimen@ \dp\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
  832.   \advance\dimen@ \ht\LT@foot
  833.   \advance\dimen@ \ht\@arstrutbox
  834.   \advance\dimen@ \dp\@arstrutbox
  835.   \advance\dimen@ -\pagegoal
  836.   \ifdim \dimen@>\z@\vfil\break\fi
  837. %    \end{macrocode}
  838. % If the foot is non empty, reduce the "\vsize" accordingly.
  839. %    \begin{macrocode}
  840.   \ifvoid\LT@foot\else
  841.     \advance\vsize-\ht\LT@foot
  842.     \dimen@\pagegoal\advance\dimen@-\ht\LT@foot\pagegoal\dimen@
  843.     \maxdepth=\z@
  844.   \fi
  845. %    \end{macrocode}
  846. % Put the table head on the page, and then switch to the new output
  847. % routine.
  848. %    \begin{macrocode}
  849.   \ifvoid\LT@firsthead\copy\LT@head\else\box\LT@firsthead\fi
  850.   \output{\LT@output}}
  851. %    \end{macrocode}
  852. % \end{macro}
  853. %
  854. % \begin{macro}{\endlongtable}
  855. % Called by "\end{longtable}".
  856. %    \begin{macrocode}
  857. \def\endlongtable{%
  858. %    \end{macrocode}
  859. % Essentially add a final "\\".
  860. %    \begin{macrocode}
  861.   \LT@echunk
  862.   \LT@start
  863.   \unvbox\z@
  864.   \LT@get@widths
  865. %    \end{macrocode}
  866. % Write the dummy row to the {\tt .aux} file.
  867. %    \begin{macrocode}
  868.   \immediate\write\@auxout
  869. %    \end{macrocode}
  870. % Since Version 3.02, {\tt longtable} has used the internal counter
  871. % "\c@LT@tables" rather than the \LaTeX\ counter {\tt table}.
  872. %    \begin{macrocode}
  873.     {\gdef\string\LT@\romannumeral\c@LT@tables{\LT@save@row}}%
  874. %    \end{macrocode}
  875. % Issue a warning if a "\multicolumn" has been set in draft mode.
  876. %    \begin{macrocode}
  877.   \LT@mcw@rn
  878. %    \end{macrocode}
  879. % If the last chunk has different widths than the first, warn the user.
  880. %    \begin{macrocode}
  881.   \ifx\LT@save@row\LT@@save@row\else
  882.     \@warning{Column widths have changed in table \thetable}\fi
  883. %    \end{macrocode}
  884. % Force one more go with the {\tt longtable} ouput routine.
  885. %    \begin{macrocode}
  886.   \endgraf\penalty -\LT@end@pen
  887. %    \end{macrocode}
  888. % Now close the group to return to the standard routine.
  889. %    \begin{macrocode}
  890.   \endgroup
  891. %    \end{macrocode}
  892. % Reset "\@mparbottom" to allow marginpars close to the end of the
  893. % table.\footnote{This can not be the correct. However if it is omitted,
  894. % there is a problem with marginpars, for example on page~3 of this
  895. % document. Any Output Routine Gurus out there?}
  896. %    \begin{macrocode}
  897.   \global\@mparbottom\z@
  898.   \pagegoal\vsize
  899.   \endgraf\penalty\z@\addvspace\LTpost
  900. %    \end{macrocode}
  901. % Footnotes. As done in {\tt multicol.sty}.
  902. %    \begin{macrocode}
  903.   \ifvoid\footins\else\insert\footins{}\fi}
  904. %    \end{macrocode}
  905. % \end{macro}
  906. %
  907. % \subsection{Counting Columns}
  908. %
  909. % Columns are counted by examining "\@preamble", rather than simply
  910. % getting "\@mkpream" to increment the counter as it builds the
  911. % preamble so that this style works with many of the styles which add
  912. % extra column specifiers to \LaTeX's standard ones.
  913. %
  914. %  Version~1 counted "\@sharp"'s to calculate the number of columns,
  915. %  this was changed for Version~2 as it does not work with the NFSS. Now
  916. %  count "&"'s. ({\tt lfonts.new} defines "\@tabclassz" so that
  917. %  "\@sharp" is inside a group.)
  918. %
  919. % \begin{macro}{\LT@nofcols}
  920. % Find the next "&", then look ahead to see what is next.
  921. %    \begin{macrocode}
  922. \def\LT@nofcols#1&{\futurelet\LT@next\LT@n@fcols}
  923. %    \end{macrocode}
  924. % \end{macro}
  925. %
  926. % \begin{macro}{\LT@n@fcols}
  927. % Add one, then stop at an "\LT@nofcols" or look for the next
  928. % "&". The "\expandafter" trick was added in Version~3, also the
  929. % name changed from "\@LT@nofcols" to preserve the "\LT@" naming
  930. % convention.
  931. %    \begin{macrocode}
  932. \def\LT@n@fcols{\advance\LT@cols\@ne
  933.   \ifx\LT@next\LT@nofcols\expandafter\@gobble
  934.   \else\expandafter\LT@nofcols\fi}
  935. %    \end{macrocode}
  936. % \end{macro}
  937. %
  938. % \subsection{The {\tt \bslash\bslash} and {\tt \bslash kill} Commands}
  939. %
  940. % \begin{macro}{\LT@tabularcr}
  941. % The internal definition of "\\".
  942. %    \begin{macrocode}
  943. \def\LT@tabularcr{%
  944. %    \end{macrocode}
  945. % Increment the counter, and do  {\tt tabular}'s "\\" or finish the
  946. % chunk. The "\expandafter" trick was added in Version~3.
  947. %    \begin{macrocode}
  948.   \global\advance\LT@rows\@ne \ifnum\LT@rows=\LTchunksize
  949.   \expandafter\LT@t@bularcr\else\expandafter\LT@LL@FM@cr\fi}
  950. %    \end{macrocode}
  951. % \end{macro}
  952. %
  953. % \begin{macro}{\LT@t@bularcr}
  954. % This definition also accepts "\\*", which acts in the same way as
  955. % "\\". {\tt tabular} does this, but {\tt longtable} probably ought to
  956. % make "\\*" prevent page breaking.
  957. % "{\ifnum0=`}\fi" added in version 3.01, required if the first entry
  958. % is empty.
  959. %    \begin{macrocode}
  960. \def\LT@t@bularcr{{\ifnum0=`}\fi
  961.   \@ifstar{\LT@xtabularcr}{\LT@xtabularcr}}
  962. %    \end{macrocode}
  963. % \end{macro}
  964. %
  965. % \begin{macro}{\LT@xtabularcr}
  966. % This justs looks for an optional argument.
  967. %    \begin{macrocode}
  968. \def\LT@xtabularcr{\@ifnextchar[{\LT@argtabularcr}{\LT@ntabularcr}}
  969. %    \end{macrocode}
  970. % \end{macro}
  971. %
  972. % \begin{macro}{\LT@ntabularcr}
  973. % The version with no optional argument.
  974. % "\ifnum0=`{\fi}" added in version 3.01.
  975. %    \begin{macrocode}
  976. \def\LT@ntabularcr{%
  977.   \ifnum0=`{\fi}%
  978.   \LT@echunk
  979.   \LT@start
  980.   \unvbox\z@
  981.   \LT@get@widths
  982.   \LT@bchunk}
  983. %    \end{macrocode}
  984. % \end{macro}
  985. %
  986. % \begin{macro}{\LT@argtabularcr}
  987. % The version with an optional argument.
  988. % "\ifnum0=`{\fi}" added in version 3.01.
  989. %    \begin{macrocode}
  990. \def\LT@argtabularcr[#1]{%
  991.   \ifnum0=`{\fi}%
  992.   \ifdim #1>\z@
  993.   \unskip\@xargarraycr{#1}\else \@yargarraycr{#1}\fi
  994. %    \end{macrocode}
  995. % Add the dummy row, and finish the "\halign".
  996. %    \begin{macrocode}
  997.   \LT@echunk
  998.   \LT@start
  999.   \unvbox\z@
  1000.   \LT@get@widths
  1001.   \LT@bchunk}
  1002. %    \end{macrocode}
  1003. % \end{macro}
  1004. %
  1005. % \begin{macro}{\LT@echunk}
  1006. % This ends the current chunk, and removes the dummy row.
  1007. %    \begin{macrocode}
  1008. \def\LT@echunk{%
  1009.   \crcr\LT@save@row\cr\egroup
  1010.   \global\setbox\@ne\lastbox
  1011.   \egroup}
  1012. %    \end{macrocode}
  1013. % \end{macro}
  1014. %
  1015. % \begin{macro}{\LT@kill}
  1016. % This ends the current chunk as above, but strips off two rows, the
  1017. % `dummy row' and the `killed row' before starting the next chunk.
  1018. % Since V3.04, the old chunk is reboxed at the start of the box
  1019. % containing the next chunk. This allows "\kill" to be used in headers,
  1020. % which must be processed in a single box.
  1021. %    \begin{macrocode}
  1022. \def\LT@kill{%
  1023.   \LT@echunk
  1024.   \LT@get@widths
  1025.   \expandafter\LT@rebox\LT@bchunk}
  1026. %    \end{macrocode}
  1027. % \end{macro}
  1028. %
  1029. % \begin{macro}{\LT@rebox}
  1030. % Drop the old chunk (box0) back at the top of the new chunk, removing
  1031. % the killed row. This macro added at V3.04.
  1032. %    \begin{macrocode}
  1033. \def\LT@rebox#1\bgroup{#1\bgroup\unvbox\z@\unskip\setbox\z@=\lastbox}%
  1034. %    \end{macrocode}
  1035. %    \begin{macrocode}
  1036.  
  1037. %    \end{macrocode}
  1038. % \end{macro}
  1039. %
  1040. % \subsection{The Dummy Row}
  1041. %
  1042. % \begin{macro}{\LT@blank@row}
  1043. % Create a blank row if we are not using the info in the .aux file. Also
  1044. % use the draft form of "\multicolumn".
  1045. %    \begin{macrocode}
  1046. \def\LT@blank@row{%
  1047.   \let\multicolumn\LTmulticolumn
  1048.     {\xdef\LT@save@row{\omit}%
  1049.     \loop
  1050.     \advance\LT@cols\m@ne
  1051.     \ifnum\LT@cols>\z@
  1052.     \xdef\LT@save@row{\LT@save@row&\omit}%
  1053.     \repeat}}
  1054. %    \end{macrocode}
  1055. % \end{macro}
  1056. %
  1057. % \begin{macro}{\LT@make@row}
  1058. % By default do not use information in the {\tt .aux} file.
  1059. %    \begin{macrocode}
  1060. \let\LT@make@row\LT@blank@row
  1061. %    \end{macrocode}
  1062. % \end{macro}
  1063. %
  1064. % \begin{macro}{\setlongtables}
  1065. % Redefine "\LT@make@row" to use information in the {\tt .aux} file,
  1066. % if there is a saved row for this table.
  1067. %
  1068. % Since Version 3.02, {\tt longtable} has used the internal counter
  1069. % "\c@LT@tables" rather than the \LaTeX\ counter {\tt table}.
  1070. % The warning message was added at V3.04, as was the "\global", to stop
  1071. % save-stack overflow.
  1072. %    \begin{macrocode}
  1073. \def\setlongtables{%
  1074.   \typeout{***^^J%
  1075.     \noexpand\setlongtables is in force.^^J%
  1076.     If you have edited the file since the last LaTeX run^^J%
  1077.     incorrect column widths, or even errors may be produced.^^J%
  1078.     ***}%
  1079.   \def\LT@make@row{%
  1080.     \global\expandafter\let\expandafter\LT@save@row
  1081.       \csname LT@\romannumeral\c@LT@tables\endcsname
  1082.     \ifx\LT@save@row\relax\LT@blank@row\fi}}
  1083. %    \end{macrocode}
  1084. % \end{macro}
  1085. %
  1086. % \begin{macro}{\LT@get@widths}
  1087. % This is the heart of {\tt longtable}. If it were not for the table
  1088. % head and foot, this macro together with the modified "\\" command
  1089. % would form the basis of quite a simple little style file for long
  1090. % tables. It is closely modelled on the "\endvrulealign" macro of
  1091. % appendix D of the \TeX{}Book.
  1092. %    \begin{macrocode}
  1093. \def\LT@get@widths{%
  1094. %    \end{macrocode}
  1095. % "\global" added at V3.04, to stop save-stack overflow.
  1096. %    \begin{macrocode}
  1097.   \global\let\LT@save@row\end
  1098. %    \end{macrocode}
  1099. % Loop through the last row, discarding glue, and saving box widths. At
  1100. % V3.04 changed the scratch box to 2, as the new "\kill" requires that
  1101. % "\box0" be preserved.
  1102. %    \begin{macrocode}
  1103.   \setbox\tw@=\hbox{\unhbox\@ne
  1104.     \loop
  1105.     \unskip
  1106.     \setbox\tw@=\lastbox
  1107.     \ifhbox\tw@
  1108.       \LT@def@row
  1109.     \repeat}%
  1110. %    \end{macrocode}
  1111. % Remember the widths if we are in the first chunk.
  1112. %    \begin{macrocode}
  1113.   \ifx\LT@@save@row\LT@undef\let\LT@@save@row\LT@save@row\fi}
  1114. %    \end{macrocode}
  1115. % \end{macro}
  1116. %
  1117. % \begin{macro}{\LT@def@row}
  1118. % Add a column to the dummy row. Name changed from "\defLT@save@row"
  1119. % in Version~3, to preserve the "\LT@" naming convention.
  1120. %    \begin{macrocode}
  1121. \def\LT@def@row{\ifx\LT@save@row\end
  1122.   \xdef\LT@save@row{\omit\kern\the\wd\tw@}\else
  1123.   \xdef\LT@save@row{\omit\kern\the\wd\tw@&\LT@save@row}\fi}
  1124. %    \end{macrocode}
  1125. % \end{macro}
  1126. %
  1127. % \subsection{The {\tt\bslash hline} Command}
  1128. %
  1129. % \begin{macro}{\LT@hline}
  1130. % "\hline" and "\hline\hline" both produce {\em two\/} lines.
  1131. % The only difference being the glue and penalties between them.
  1132. % This is so that a page break at a "\hline" produces a line on both
  1133. % pages.\footnote
  1134. % {{\tt longtable} has always done this, but perhaps it would be
  1135. % better if hlines were {\em omitted\/} at a page break, as the head and
  1136. % foot usually put a hline here anyway.}
  1137. % Also this "\hline" is more like a "\cline[1-\LT@cols]".
  1138. % {\tt tabular}'s "\hline" would draw lines the full width of the page.
  1139. %    \begin{macrocode}
  1140. \def\LT@hline{\noalign{\ifnum0=`}\fi
  1141.    \penalty\@M
  1142.    \futurelet\LT@next\LT@@hline}
  1143. %    \end{macrocode}
  1144. % \end{macro}
  1145. %
  1146. % \begin{macro}{\LT@@hline}
  1147. % This code is based on "\cline". Two copies of the line are produced,
  1148. % as described above.
  1149. %    \begin{macrocode}
  1150. \def\LT@@hline{%
  1151.   \ifx\LT@next\hline
  1152.     \global\let\LT@next\@gobble
  1153.     \gdef\LT@sep{\penalty-\@medpenalty\vskip\doublerulesep}%
  1154.   \else
  1155.     \global\let\LT@next\empty
  1156.     \gdef\LT@sep{\penalty-\@lowpenalty\vskip-\arrayrulewidth}%
  1157.   \fi\ifnum0=`{\fi}%
  1158.   \multispan\LT@cols
  1159.      \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
  1160.   \noalign{\LT@sep}%
  1161.   \multispan\LT@cols
  1162.      \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
  1163.   \noalign{\penalty\@M}%
  1164.   \LT@next}
  1165. %    \end{macrocode}
  1166. % \end{macro}
  1167. %
  1168. % \subsection{Captions}
  1169. %
  1170. % \begin{macro}{\LT@caption}
  1171. % The caption is "\multicolumn{\LT@cols}{c}{"\meta{a parbox with the
  1172. % table's caption}"}"
  1173. %    \begin{macrocode}
  1174. \def\LT@caption{\noalign\bgroup
  1175.   \@ifnextchar[{\egroup\LT@c@ption}{\LT@capti@n}}
  1176. %    \end{macrocode}
  1177. % \end{macro}
  1178. %
  1179. % \begin{macro}{\LT@c@ption}
  1180. % Caption command (with [optional argument]).  "\protect" added in
  1181. % Version~3.
  1182. %    \begin{macrocode}
  1183. \def\LT@c@ption[#1]#2{%
  1184.   \LT@mkcaption{Table \thetable: #2}%
  1185.   \def\@tempa{#1}\ifx\@tempa\empty\else
  1186.      {\let\\\space
  1187.      \addcontentsline{lot}{table}{\protect\numberline{\thetable}{#1}}}%
  1188.   \fi}
  1189. %    \end{macrocode}
  1190. % \end{macro}
  1191. %
  1192. % \begin{macro}{\LT@capti@n}
  1193. % Caption command (no [optional argument])
  1194. %    \begin{macrocode}
  1195. \def\LT@capti@n{\@ifstar{\egroup\LT@mkcaption}{\egroup\LT@@c@ption}}
  1196. %    \end{macrocode}
  1197. % \end{macro}
  1198. %
  1199. % \begin{macro}{\LT@@c@ption}
  1200. % Caption command (no [optional argument] or *). "\protect" added in
  1201. % Version~3.
  1202. %    \begin{macrocode}
  1203. \def\LT@@c@ption#1{%
  1204.   \LT@mkcaption{Table \thetable: #1}%
  1205.   {\let\\\space
  1206.    \addcontentsline{lot}{table}{\protect\numberline{\thetable}{#1}}}}
  1207. %    \end{macrocode}
  1208. % \end{macro}
  1209. %
  1210. % \begin{macro}{\LT@mkcaption}
  1211. % Put the caption in a box of width 0pt, so that it never affects the
  1212. % column widths. Inside that is a "\parbox" of width
  1213. % "\LTcapwidth".
  1214. %    \begin{macrocode}
  1215. \def\LT@mkcaption#1{%
  1216.   \LT@mc{\LT@cols}{c}{\hbox to \z@{\hss\parbox[t]{\LTcapwidth}{%
  1217. %    \end{macrocode}
  1218. % {\tt article.sty}'s "\@makecaption" (without the 10pt skip at the
  1219. % top).
  1220. %    \begin{macrocode}
  1221.     \setbox\@tempboxa\hbox{#1}%
  1222.    \ifdim \wd\@tempboxa >\hsize #1
  1223.      \else \hbox to\hsize{\hfil\box\@tempboxa\hfil}\fi
  1224.             \endgraf\vskip\baselineskip}\hss}}}
  1225. %    \end{macrocode}
  1226. % \end{macro}
  1227. %
  1228. % \subsection{The Output Routine}
  1229. %
  1230. % The method used here for interfacing a special purpose output routine
  1231. % to the standard \LaTeX\ routine is lifted straight out of
  1232. % F.~Mittelbach's {\tt multicol.sty}.
  1233. %
  1234. % \begin{macro}{\LT@output}
  1235. %     Actually this is not so bad, with FM leading the way.
  1236. %    \begin{macrocode}
  1237. \def\LT@output{%
  1238.   \ifnum\outputpenalty <-\@Mi
  1239.     \ifnum\outputpenalty > -\LT@end@pen
  1240. %    \end{macrocode}
  1241. %     If this was a float or a marginpar we complain.
  1242. %    \begin{macrocode}
  1243.       \@latexerr{floats and marginpars not allowed in a longtable}\@ehc
  1244.     \else
  1245. %    \end{macrocode}
  1246. % We have reached the end of the table, on the scroll at least,
  1247. %    \begin{macrocode}
  1248.       \setbox\z@\vbox{\unvbox\@cclv}%
  1249.       \ifdim \ht\LT@lastfoot>\ht\LT@foot
  1250. %    \end{macrocode}
  1251. % The last foot might not fit, so:\footnote{An alternative would be to
  1252. % vsplit off a bit of the last chunk, so that the last page did not just
  1253. % have head and foot sections, but it is hard to do this in a consistent
  1254. % manner.}
  1255. %    \begin{macrocode}
  1256.         \dimen@=\pagegoal
  1257.         \advance\dimen@-\ht\LT@lastfoot
  1258.         \ifdim\dimen@<\ht\z@
  1259.           \setbox\@cclv=\vbox{\unvbox\z@\copy\LT@foot\vss}%
  1260.           \@makecol
  1261.           \@outputpage
  1262.           \setbox\z@\vbox{\box\LT@head}%
  1263. %    \end{macrocode}
  1264. % End of "\ifdim\dimen@<\ht\@cclc".
  1265. %    \begin{macrocode}
  1266.         \fi
  1267. %    \end{macrocode}
  1268. % End of "\ifdim \ht\LT@lastfoot > \ht\LT@foot".
  1269. %    \begin{macrocode}
  1270.       \fi
  1271.       \vbox
  1272.         {\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}%
  1273. %    \end{macrocode}
  1274. % End of "\ifnum\outputpenalty > -\LT@end@pen".
  1275. %    \begin{macrocode}
  1276.     \fi
  1277. %    \end{macrocode}
  1278. % Else "\outputpenalty > -\@Mi".
  1279. %    \begin{macrocode}
  1280.   \else
  1281. %    \end{macrocode}
  1282. % If we have not reached the end of the table,
  1283. %    \begin{macrocode}
  1284.     \setbox\@cclv=\vbox{\unvbox\@cclv\copy\LT@foot\vss}%
  1285.     \@makecol
  1286.     \@outputpage
  1287. %    \end{macrocode}
  1288. % Put the head at the top of the next page.
  1289. %    \begin{macrocode}
  1290.     \copy\LT@head
  1291. %    \end{macrocode}
  1292. % End of "\ifnum\outputpenalty <-\@Mi".
  1293. %    \begin{macrocode}
  1294.   \fi}
  1295. %    \end{macrocode}
  1296. % \end{macro}
  1297. %
  1298. % \subsection{Commands for the the table head and foot}
  1299. %
  1300. % \begin{macro}{\LT@end@hd@ft}
  1301. % The core of "\endhead" and friends. Store the current chunk in the
  1302. % box specified by "#1". Issue an error if the table has already
  1303. % started. Then start a new chunk.
  1304. %    \begin{macrocode}
  1305. \def\LT@end@hd@ft#1{%
  1306.   \LT@echunk
  1307. %    \end{macrocode}
  1308. % Changed from "\relax" to "\endgraf" at V3.04, see "\LT@start".
  1309. %    \begin{macrocode}
  1310.   \ifx\LT@start\endgraf\@latexerr
  1311.    {Longtable head or foot not at start of table}{Increase chunksize}\fi
  1312.   \setbox#1\box\z@
  1313.   \LT@get@widths
  1314.   \LT@bchunk}
  1315. %    \end{macrocode}
  1316. % \end{macro}
  1317. %
  1318. % \begin{macro}{\endfirsthead}
  1319. % \begin{macro}{\endhead}
  1320. % \begin{macro}{\endfoot}
  1321. % \begin{macro}{\endlastfoot}
  1322. % Call "\LT@end@hd@ft" with the appropriate box.
  1323. %    \begin{macrocode}
  1324. \def\endfirsthead{\LT@end@hd@ft\LT@firsthead}
  1325. \def\endhead{\LT@end@hd@ft\LT@head}
  1326. \def\endfoot{\LT@end@hd@ft\LT@foot}
  1327. \def\endlastfoot{\LT@end@hd@ft\LT@lastfoot}
  1328. %    \end{macrocode}
  1329. % \end{macro}
  1330. % \end{macro}
  1331. % \end{macro}
  1332. % \end{macro}
  1333. %
  1334. % \subsection{The {\tt\bslash multicolumn} command}
  1335. %
  1336. % \begin{macro}{\LTmulticolumn}
  1337. % A temporary definition of "\multicolumn" to use if we are ignoring
  1338. % the saved row in the {\tt .aux} file.
  1339. % Hide the width of the entry with "\hidewidth\null", and warn the
  1340. % user at the end that this `draft' version of "\multicolumn" has been
  1341. % used.
  1342. %    \begin{macrocode}
  1343. \def\LTmulticolumn#1#2#3{%
  1344.   \LT@mc{#1}{#2}{#3}\hidewidth\null
  1345.   \global\let\LT@mcw@rn\LT@mcwarn}
  1346. %    \end{macrocode}
  1347. % \end{macro}
  1348. %
  1349. % \begin{macro}{\LT@mcwarn}
  1350. % Typeout a warning if "\LTmulticolumn" has been used.
  1351. %    \begin{macrocode}
  1352. \def\LT@mcwarn{\@warning{%
  1353.   \string\multicolumn\space set in draft mode in table \thetable}}
  1354. %    \end{macrocode}
  1355. % \end{macro}
  1356. %
  1357. % \subsection{Footnotes}
  1358. %
  1359. % The standard "\footnote" command works in a {\tt c} column, but we
  1360. % need to modify the definition in a {\tt p} column to overcome the
  1361. % extra level of boxing. These macros are based on {\tt array.sty}, but
  1362. % should be OK for the standard {\tt tabular}.
  1363. %
  1364. % \begin{macro}{\LT@startpbox}
  1365. % Add extra code to switch the definition of "\@footnotetext".
  1366. %    \begin{macrocode}
  1367. \def\LT@startpbox#1{\bgroup
  1368.   \let\@footnotetext\LT@p@ftntext\hsize #1 \@arrayparboxrestore
  1369.   \vrule \@height \ht\@arstrutbox \@width \z@}
  1370. %    \end{macrocode}
  1371. % \end{macro}
  1372. %
  1373. % \begin{macro}{\LT@endpbox}
  1374. % After the parbox is closed, expand "\LT@p@ftn" which will execute a
  1375. % series of\\
  1376. % "\footnotetext["\meta{num}"]{"\meta{note}"}"\\
  1377. % commands. After being lifted out of the parbox, they can migrate on
  1378. % their own from here.
  1379. %    \begin{macrocode}
  1380. \def\LT@endpbox{\unskip\vrule \@width\z@ \@depth \dp\@arstrutbox \egroup
  1381.        \the\LT@p@ftn\global\LT@p@ftn{}}
  1382. %    \end{macrocode}
  1383. % \end{macro}
  1384. %
  1385. % \begin{macro}{\LT@p@ftntext}
  1386. % Inside the `p' column, just save up the footnote text in a token
  1387. % register.
  1388. %    \begin{macrocode}
  1389. \def\LT@p@ftntext#1{%
  1390.   \edef\@tempa{\the\LT@p@ftn\noexpand\footnotetext[\the\c@footnote]}%
  1391.   \global\LT@p@ftn\expandafter{\@tempa{#1}}}%
  1392. %    \end{macrocode}
  1393. % \end{macro}
  1394. %
  1395. %    \begin{macrocode}
  1396. %</style>
  1397. %    \end{macrocode}
  1398. %
  1399. % \section{The documentation driver file}
  1400. %
  1401. % The next bit of code contains the documentation driver file for
  1402. % \TeX{}, i.e., the file that will produce the documentation you are
  1403. % currently reading. It will be extracted from this file by the {\tt
  1404. % docstrip} program.
  1405. %    \begin{macrocode}
  1406. %<+driver>\documentstyle[longtable,doc]{article}
  1407. %<+driver>
  1408. %<+driver>% dimensions from ltugboat.sty:
  1409. %<+driver>
  1410. %<+driver>\setlength\textwidth{31pc} \setlength\textheight{54pc}
  1411. %<+driver>\parindent 0pt \parskip 2pt plus 1pt minus 1pt
  1412. %<+driver>\setlength{\oddsidemargin}{8pc}
  1413. %<+driver>\setlength{\marginparwidth}{8pc}
  1414. %<+driver>\setlength{\topmargin}{-2.5pc}
  1415. %<+driver>\setlength{\headsep}{20pt}
  1416. %<+driver>\setlength{\columnsep}{1.5pc}
  1417. %<+driver>\setlength{\columnwidth}{18.75pc}
  1418. %<+driver>
  1419. %<+driver>\MakeShortVerb{\"}  % "\foo" acts like \verb+\foo+
  1420. %<+driver>
  1421. %<+driver>\DisableCrossrefs
  1422. %<+driver>
  1423. %<+driver>\CodelineIndex                  % Index code by line number
  1424. %<+driver>
  1425. %<+driver>%\OnlyDescription   % comment out for implementation details
  1426. %<+driver>
  1427. %<+driver>%\setlongtables     % Uncomment this line to cause longtables
  1428. %<+driver>                    % to line up correctly.
  1429. %<+driver>
  1430. %<+driver>\setcounter{StandardModuleDepth}{1}
  1431. %<+driver>
  1432. %<+driver>\begin{document}
  1433. %<+driver>   \DocInput{longtable.doc}
  1434. %<+driver>\end{document}
  1435. %    \end{macrocode}
  1436. %
  1437. %
  1438. % \Finale
  1439. \endinput
  1440.